import type {PageParam, PageResult} from '@vben/request';
import type {Dayjs} from 'dayjs';

import {requestClient} from '#/api/request';
export namespace PerFamilyInsuranceApi {
  /** 投资型保险情况信息 */
  export interface FamilyInsurance {
    id: number; // 主键ID
    employeeId?: number; // 人员ID，对应 per_employee.id
    relation: string; // 与本人关系（称谓）
    systemPersonId: number; // 系统人员ID，对应 system_person.id
    familyName: string; // 家庭成员姓名
    cardType: string; // 证件类型
    familyIdcard: string; // 家庭成员身份证号
    insuranceNamePolicy: string; // 保险产品全称及保单号
    insuranceCompany: string; // 保险公司名称
    totalInvestPremium: number; // 累积缴纳保费投资金
    recordDate: string; // 记录时间
    status: number; // 是否有效（1：有效，0：无效）
  }
}

/** 查询投资型保险情况分页 */
export function getFamilyInsurancePage(data: PageParam,desensitize: boolean,encrypt: boolean) {
  return requestClient.post<PageResult<PerFamilyInsuranceApi.FamilyInsurance>>('/per/family-insurance/page', data,{ desensitize,encrypt });
}

/** 查询投资型保险情况详情 */
export function getFamilyInsurance(id: number) {
  return requestClient.get<PerFamilyInsuranceApi.FamilyInsurance>(`/per/family-insurance/get?id=${id}`);
}

/** 新增投资型保险情况 */
export function createFamilyInsurance(data: PerFamilyInsuranceApi.FamilyInsurance) {
  return requestClient.post('/per/family-insurance/create', data);
}

/** 修改投资型保险情况 */
export function updateFamilyInsurance(data: PerFamilyInsuranceApi.FamilyInsurance) {
  return requestClient.put('/per/family-insurance/update', data);
}

/** 删除投资型保险情况 */
export function deleteFamilyInsurance(id: number) {
  return requestClient.delete(`/per/family-insurance/delete?id=${id}`);
}

/** 批量删除投资型保险情况 */
export function deleteFamilyInsuranceList(ids: number[]) {
  return requestClient.delete(`/per/family-insurance/delete-list?ids=${ids.join(',')}`)
}

/** 导出投资型保险情况 */
export function exportFamilyInsurance(params: any) {
  return requestClient.download('/per/family-insurance/export-excel', { params });
}
